home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Programmer Disk
/
The Programmer Disk (Microforum).iso
/
xpro
/
vc
/
pro3
/
box1.c
< prev
next >
Wrap
Text File
|
1993-05-25
|
3KB
|
83 lines
===========================================================================
BBS: The Abacus * HST/DS * Potterville MI
Date: 05-22-93 (20:31) Number: 98
From: BRIAN FRASER Refer#: 152
To: JIM BURNS Recvd: NO
Subj: ASCII BOXES Conf: (36) C Language
---------------------------------------------------------------------------
-=> Jim Burns wrote in a message to All: <=-
Hello Jim!
JB> I'm having a problem with a simple function that given the
JB> ranges for x and y builds a box with ascii characters, 179,
JB> 196,191,192,218, it's straightforword, but the frustration
JB> comes when I try to place the lower right corner, 217.
JB> Despite changeing the order of placement, after the
JB> character is written to the lowest right coordinate the
JB> cursor automatically gets a carriage return/line feed and
JB> the entire thing shifts up a line and off alignment. I've
JB> noticed that even borlands C++ environment doesn't write
JB> it's boxes to the lowest right corner, should I be taking
JB> the hint, I ran across a little idea to write directly to
JB> the video board, but I'm not sure it really works and then
JB> what about portability is the color video address always
JB> xB8000 ? .
I gather you are using BC++... If you are using the CONIO text routines. There i
s a global _wscroll . It defaults to 1, but if you set it to 0, then the routine
s wont scroll the window.
Here's a routine I have written to draw a box on the screen...
-!--8<---------------------------------
void draw_box(byte x,byte y,byte x2,byte y2)
{
unsigned int b1,b2;
char box[]={'\xD5','\xB8','\xD4','\xBE','\xCD','\xB3'};
window(x,y,x2,y2);
clrscr();
window(1,1,80,25);
gotoxy(x,y);
putch(box[0]);
for(b1=(x2-x)-1;b1>0;b1--)
{
putch(box[4]);
}
putch(box[1]);
for(b1=y+1;b1<y2;b1++)
{
gotoxy(x,b1);
putch(box[5]);
gotoxy(x2,b1);
putch(box[5]);
}
gotoxy(x,y2);
putch(box[2]);
for(b1=(x2-x)-1;b1>0;b1--)
{
putch(box[4]);
}
putch(box[3]);
gotoxy(x+1,y+1);
}
-!------------------------->8----------
This works pretty good. I use it when ever I don't want to include a windowing l
ibarry in a programme. Enjoy.. :)
Chow...
Brian
--- timEd/B8
* Origin: ** Dragon's Eye BBS 604/-Unpublished- 2400 BPS! ** (1:153/612)
SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1
SEEN-BY: 153/752 154/40 77 157/2 159/100 125 575 950 203/23 209/209 261/1023
SEEN-BY: 280/1 390/1 396/1 5 15 2270/1 2440/5 3603/20